package com.xrz.sxm.aj.view;

import com.xrz.sxm.aj.utils.XUtilBitmapUtil;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.ImageView;
import android.widget.ImageView.ScaleType;
import android.widget.RelativeLayout;


public class LoadImageView extends RelativeLayout{

	private ImageView m_ImageView;
	private PieProgress m_Progress;
	private LayoutParams params;
	public LoadImageView(Context context, AttributeSet attrs) {
		super(context, attrs);
		init();
	}

	public LoadImageView(Context context) {
		super(context);
		init();   
	}

	public LoadImageView(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);
		init();
	}

	private void init(){
		m_ImageView = new ImageView(getContext());
		m_Progress = new PieProgress(getContext());
		params = new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT);
		m_ImageView.setLayoutParams(params);
		m_ImageView.setScaleType(ScaleType.FIT_XY); 
		addView(m_ImageView); 
		params = new LayoutParams(80, 80);  
		params.addRule(CENTER_IN_PARENT);   
		addView(m_Progress, params);  
	}
	
	public void loadImage(String url){
		XUtilBitmapUtil.getInstant().display(getContext(), m_ImageView, m_Progress, url);
	}
	
}
